package com.yuexunit.mobilenurse.module.BloodManage.model.impl;

import com.yuexunit.mobilenurse.module.BloodManage.Api.BloodApplyApi;
import com.yuexunit.mobilenurse.module.BloodManage.bean.BloodDataBean;
import com.yuexunit.mobilenurse.module.BloodManage.bean.SingleBloodBag;
import com.yuexunit.mobilenurse.module.BloodManage.model.IBloodApplyModel;
import com.yuexunit.mobilenurse.util.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by work-jx on 2017/10/24.
 */
public class BloodApplyModel implements IBloodApplyModel{
    private BloodApplyApi api;

    public BloodApplyApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi_BloodManage(BloodApplyApi.class);
        }
    }


    @Override
    public Observable<BloodDataBean> getBloodDataList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getBloodList(praise);
    }

    @Override
    public Observable<SingleBloodBag> getBloodBagData(Map<String, String> praise) {
        api = ApiInstance();
        return api.scanBloodBag(praise);
    }
}
